package Turma.Jogo;

import android.framework.Graphics;
import android.framework.Pixmap;
import android.framework.Graphics.PixmapFormat;

public abstract class GameObject 
{
	protected Graphics graphics;
	protected Pixmap image;	

	protected float x, y;
	protected int w, h;
	
	public GameObject(Graphics graphics, String filename, PixmapFormat format, float x, float y, int w, int h)
	{
		this.graphics = graphics;
		this.image = graphics.newPixmap(filename, format);
		this.x = x;
		this.y = y;
		this.w = w;
		this.h = h;
	}

	public GameObject(Graphics graphics, Pixmap pixmap)
	{
		this.graphics = graphics;	
		this.image = pixmap;
	}
	
	public boolean Collision(GameObject object)
	{
		return (this.x < object.x + object.w &&
				this.x + this.w > object.x   &&
				this.y < object.y + object.h &&
				this.y + this.h > object.y);
	}

	public void update(float deltaTime)
	{
		
	}
	
	public void draw(float deltaTime, Graphics graphics)
	{
		//if(w == 0 && h == 0)
		//{
		this.graphics.drawPixmap(this.image, (int)this.x, (int)this.y);
		//}
		//else
		//{
		//	this.graphics.drawPixmap(this.image, (int)this.x, (int)this.y, w, h, (int)x, (int)y);
		//}
	}	
}
